import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  { //重定向到登录页面
    path: "/",
    redirect: "/layout"
  },
  {
    path: "/login",
    name: "Login",
    meta: {
      title: "登录"
    },
    component: () => import("@/views/login/index.vue")
  },
  { //默认路由
    path: "/layout",
    name: "Layout",
    meta: {
      title: "首页",
    },
    component: () => import("@/layout/index.vue"),

  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
